Shape.Composite
Composite of several individual shapes. The composite contains a set of positive shapes and an optional set of negative shapes, and the final shape is the union of all positive shapes, with the union of all negative shapes removed. The order of the shapes has no significance.
- Shape.Composite.addShape(composite, shape, isPositive)
- Arguments:
composite (
Shape.Composite)shape (
Shape)isPositive (
boolean)
Add a shape to the composite
- Shape.Composite.clone(inputComposite)
- Argument:
inputComposite (
Shape.Composite)
- Return type:
Create an independent deep copy of the composite
- Shape.Composite.contains(composite, point)
- Arguments:
composite (
Shape.Composite)point (
Point)
- Return type:
boolean
Check if the given point is within this composite (within any of the positive shapes but not within any of the negative ones). False is returned if any invalid shape is in the composite.
- Shape.Composite.create()
- Return type:
Create an empty shape composite
- Shape.Composite.getPositiveBoundingBox(composite)
- Argument:
composite (
Shape.Composite)
- Return type:
Get a bounding box of all positive shapes. This box is guaranteed to contain the entire region but might not be the tightest possible box if negative regions are used.
- Shape.Composite.getShape(composite, index)
- Arguments:
composite (
Shape.Composite)index (
int)
- Return type:
Get one of the shapes and its associated isNegative flag
- Shape.Composite.getShapeCount(composite)
- Argument:
composite (
Shape.Composite)
- Return type:
int
Get the number of shapes contained in this composite
- Shape.Composite.toImage(composite, referenceImage, worldValue)
- Arguments:
composite (
Shape.Composite)referenceImage (
Image)worldValue (
float)
- Return type:
Convert the composite shape into an image, setting pixels within the shape contour to a specific value. The value is in world coordinates and is cropped to the representable range. Pixels outside are set to pixel value zero.
- Shape.Composite.toPixelRegion(composite, referenceImage)
- Arguments:
composite (
Shape.Composite)referenceImage (
Image)
- Return type:
Convert a shape composite to a pixel region. This is useful for showing the composite in a viewer, or to use the composite region as input to image processing methods.
- Shape.Composite.toPolygons(inputComposite, epsilon, maxPoints)
- Arguments:
inputComposite (
Shape.Composite)epsilon (
float)maxPoints (
int)
- Return type:
Convert the shape composite to a composite consisting only of polygons. All circle and ellipses in the input are approximated by polygons with a given maximum error.
- Shape.Composite.toString(composite)
- Argument:
composite (
const object)
- Return type:
string
Gets a user-friendly string description of the composite shape.
- Shape.Composite.transform(composite, transform)
- Arguments:
composite (
Shape.Composite)transform (
Transform)
- Return type:
Transform the composite according to a general 2D transformation. Requires that all individual shapes support the transformation. For example, if one of the shapes is a circle and the transformation is an affine transformation, the operation will fail, since circles are no longer circles after an affine transformation. For transforming any kind of composite, consider converting the composite to a polygon representation using toPolygons first.